_base_ = [
    '../../_base_/custom_imports.py',
    '../../_base_/datasets/APTOS.py',
    '../../_base_/schedules/imagenet_dense.py',
    '../../_base_/default_runtime.py',
]

lr = 6e-4
n = 1

dataset = 'APTOS'
exp_num = 1

run_name = f'clip-base_{dataset}'

model = dict(
    type='Sep_ImageClassifier',
    backbone=dict(
        type='FullClip',
        arch='base',
        patch_size=16,
        img_size=224,
        pre_norm=True,
        ),
    head=dict(
        type='LinearClsHead',
        num_classes=5,
        in_channels=768,
        loss=dict(type='CrossEntropyLoss', loss_weight=1.0),
    ))
data = dict(
    samples_per_gpu=128,  # use 2 gpus, total 128
    train=dict(
        ann_file=f'data/MedFMC/{dataset}/trainval.txt'),
    val=dict(ann_file=f'data/MedFMC/{dataset}/test.txt'),
    test=dict(ann_file=f'data/MedFMC/{dataset}/test.txt'))

optimizer = dict(lr=lr)

log_config = dict(
    interval=10, hooks=[
        dict(type='TextLoggerHook'),
    ])

load_from = 'work_dirs/clip-vit-base-p16_laion2b-in12k-pre_3rdparty_in1k_20221220-a5e31f8c.pth'
work_dir = f'work_dirs/full/{run_name}/exp{exp_num}'

runner = dict(type='EpochBasedRunner', max_epochs=20)

# yapf:disable
log_config = dict(
    interval=10,
    hooks=[
        dict(type='TextLoggerHook'),
    ])
